<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace app\admin\route;

use app\admin\middleware\AdminSessionMiddleware;
use app\admin\middleware\AllowOriginMiddleware;
use think\facade\Route;
use think\facade\View;

Route::group(function (){
    Route::group('login/', function() {
        Route::get('login', 'login');
        Route::post('loginInfo', 'loginInfo');
        Route::get('loginOut', 'loginOut');
    })->prefix('Login/');

    // 需要登录
    Route::group(function(){
        Route::get('','Index/index');
        Route::get('/','Index/index');
        Route::get('index','Index/index');
        //首页
        Route::group('index/', function() {
            Route::get('index','index')->name('homeIndex');
        })->prefix('Index/');
        //管理员
        Route::group('admin/', function() {
            Route::get('index','index')->name('adminIndex');
            Route::post('list','list')->name('adminList');
            Route::get('addAdmin/form','addAdminForm')->name('addAdminForm');
            Route::post('addAdmin/data','addAdminData')->name('addAdminData');
            Route::get('editAdmin/form','editAdminForm')->name('editAdminForm');
            Route::post('updateAdmin/data','updateAdmin')->name('updateAdmin');
            Route::post('deleteAdmin','deleteAdmin')->name('deleteAdmin');
        })->prefix('Admin/');
        //角色
        Route::group('role/', function() {
            Route::get('index','index')->name('roleIndex');
            Route::post('list','list')->name('roleList');
            Route::get('add/form','addForm')->name('roleAddForm');
            Route::post('add/data','addData')->name('roleAddData');
            Route::get('edit/form','editForm')->name('roleEditForm');
            Route::post('update/data','updateData')->name('roleUpdateData');
            Route::post('deleteInfo','deleteInfo')->name('roleDeleteInfo');;
        })->prefix('Role/');

        //站点
        Route::group('station/', function() {
            Route::get('index','index')->name('stationIndex');
            Route::get('index2','index2')->name('communityIndex');
            Route::post('list','list')->name('stationList');
            Route::post('lists','lists')->name('lists');
            Route::get('edit2/form','edit2Form')->name('edit2Form');
            Route::post('update/data2','updateData2')->name('updateData2');
            Route::get('add/form','addForm')->name('stationAddForm');
            Route::post('add/data','addData')->name('stationAddData');
            Route::get('edit/form','editForm')->name('stationEditForm');
            Route::post('update/data','updateData')->name('stationUpdateData');
            Route::post('delete/data','deleteData')->name('stationDeleteInfo');
            Route::get('tixin','tixin')->name('tixianIndex');
        })->prefix('station.Station/');


        Route::group('tixian/', function() {
            Route::get('index','index')->name('tixianIndex');
            Route::post('list','list')->name('tixianList');
            Route::get('edit/form','editForm')->name('tixianEditForm');
            Route::post('update/data','updateData')->name('tixianUpdateData');
        })->prefix('station.Tixin/');

        //充电桩
        Route::group('pile/', function() {
            Route::get('index','index')->name('pileIndex');
            Route::post('list','list')->name('pileList');
            Route::get('add/form','addForm')->name('pileAddForm');
            Route::post('add/data','addData')->name('pileAddData');
            Route::get('edit/form','editForm')->name('pileEditForm');
            Route::post('update/data','updateData')->name('pileUpdateData');
            Route::post('delete/data','deleteData')->name('pileDeleteInfo');
            Route::get('details/info','pileInfo')->name('pileDetailsInfo');
        })->prefix('station.ChargePile/');

        //文章分类
        Route::group('articleType/', function() {
            Route::get('index','index')->name('articleTypeIndex');
            Route::post('list','list')->name('articleTypeList');
            Route::get('add/form','addForm')->name('articleTypeAddForm');
            Route::post('add/data','addData')->name('articleTypeAddData');
            Route::get('edit/form','editForm')->name('articleTypeEditForm');
            Route::post('update/data','updateData')->name('articleTypeUpdateData');
            Route::post('delete/data','deleteData')->name('articleTypeDeleteInfo');
        })->prefix('content.ArticleType/');

        //文章
        Route::group('article/', function() {
            Route::get('index','index')->name('articleIndex');
            Route::post('list','list')->name('articleList');
            Route::get('add/form','addForm')->name('articleAddForm');
            Route::post('add/data','addData')->name('articleAddData');
            Route::get('edit/form','editForm')->name('articleEditForm');
            Route::post('update/data','updateData')->name('articleUpdateData');
            Route::post('delete/data','deleteData')->name('articleDeleteInfo');
        })->prefix('content.Article/');

        //app启动页广告
        Route::group('appFiring/', function() {
            Route::get('index','index')->name('appFiringAdvertIndex');
            Route::post('list','list')->name('appFiringAdvertList');
            Route::get('add/form','addForm')->name('appFiringAdvertAddForm');
            Route::post('add/data','addData')->name('appFiringAdvertAddData');
            Route::get('edit/form','editForm')->name('appFiringAdvertEditForm');
            Route::post('update/data','updateData')->name('appFiringAdvertUpdateData');
            Route::post('delete/data','deleteData')->name('appFiringAdvertDeleteInfo');
        })->prefix('content.AppFiring/');

        //首页轮播图
        Route::group('rotationAdvert/', function() {
            Route::get('index','index')->name('rotationAdvertIndex');
            Route::post('list','list')->name('rotationAdvertList');
            Route::get('add/form','addForm')->name('rotationAdvertAddForm');
            Route::post('add/data','addData')->name('rotationAdvertAddData');
            Route::get('edit/form','editForm')->name('rotationAdvertEditForm');
            Route::post('update/data','updateData')->name('rotationAdvertUpdateData');
            Route::post('delete/data','deleteData')->name('rotationAdvertDeleteInfo');
        })->prefix('content.RotationAdvert/');

        //计费模型
        Route::group('billingModel/', function() {
            Route::get('index','index')->name('billingModelIndex');
            Route::post('list','list')->name('billingModelList');
            Route::get('add/form','addForm')->name('billingModelAddForm');
            Route::post('add/data','addData')->name('billingModelAddData');
            Route::get('edit/form','editForm')->name('billingModelEditForm');
            Route::post('update/data','updateData')->name('billingModelUpdateData');
            Route::post('delete/data','deleteData')->name('billingModelDeleteInfo');
            Route::get('info/data','getInfo')->name('billingModelgetInfo');
        })->prefix('station.BillingModel/');

        //用户
        Route::group('user/', function() {
            Route::get('index','index')->name('userIndex');
            Route::post('list','list')->name('userList');
            Route::get('edit/form','editForm')->name('userEditForm');
            Route::post('update/data','updateData')->name('userUpdateData');
            Route::get('edit/balance','editBalance')->name('userBalanceForm');
            Route::post('update/balance','updateBalance')->name('userUpdateBalance');
            Route::get('details/info','getInfo')->name('userDetailsInfo');
        })->prefix('user.User/');

        //用户车库
        Route::group('userCar/', function() {
            Route::get('index','index')->name('userCarIndex');
            Route::post('list','list')->name('userCarList');
        })->prefix('user.UserCar/');

        //订单
        Route::group('order/', function() {
            Route::get('index','index')->name('ykcOrderIndex');
            Route::post('list','list')->name('ykcOrderList');
            Route::get('details/page','getDetailsPage')->name('ykcOrderDetailsPage');
        })->prefix('order.YkcOrder/');

        //上传
        Route::group('upload/', function() {
            Route::post('station/moreImage','stationUploadMoreImg')->name('stationUploadMoreImg');
            Route::post('images/uploadImg','imagesUploadImg')->name('imagesUploadImg');
        })->prefix('common.Common/');
        //上传
        Route::group('common/', function() {
            Route::any('seat/getSeat','getSeat')->name('seatGetSeat');
        })->prefix('common.Common/');

        //获取地区
        Route::group('area/', function() {
            Route::post('allList','getAllList')->name('areaAllList');

        })->prefix('common.Area/');

        //用户等级
        Route::group('userLevel/', function() {
            Route::get('index','index')->name('userLevelIndex');
            Route::get('add/form','addForm')->name('userLevelAddForm');
            Route::post('add/data','addData')->name('userLevelAddData');
            Route::post('list','list')->name('userLevelList');
            Route::get('edit/form','editForm')->name('userLevelEditForm');
            Route::post('update/data','updateData')->name('userLevelUpdateData');
            Route::post('delete/data','deleteData')->name('userLevelDeleteInfo');
        })->prefix('user.UserLevel/');

        //用户等级
        Route::group('userRecharge/', function() {
            Route::get('index','index')->name('userLevelIndex');
            Route::post('list','list')->name('userLevelList');
        })->prefix('user.userRecharge/');

        //没有对应权限
        Route::any('notPower', function() {
            return View::fetch('index/notPower');
        })->name('notPower');


    })->middleware(AdminSessionMiddleware::class);



    // 路由不存在
    Route::miss(function() {
        //abort(404, '页面异常');
        return json()->data(['status'=>400,'message'=>'请求不存在','data'=>[],'code'=>404]);
    });
})->middleware(AllowOriginMiddleware::class);


